home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
kowin
/
archive
/
apl
/
gview120.lzh
/
gviewsrc.lzh
/
hg_load.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-13
|
1KB
|
67 lines
/* Copyright 1992 H.Ogasawara (COR.) */
#include <corlib.h>
#include <sys_doslib.h>
#include "gview.h"
#define HGLOADER "hg.r -l0,0"
static int sizex, sizey;
static unsigned char com[1024];
static int color;
static unsigned char *hg_palet;
static
size_check( fname )
char *fname;
{
int fn;
unsigned char *p;
if( (fn= OPEN( fname, 0 )) >= 0 ){
READ( fn, p= com, 1024 );
CLOSE( fn );
if( strncmp( p, "HG2", 3 ) ){
GV_Err( "hgフォーマットが違います" );
return FALSE;
}
for( com[1023]= 0x1a ; *p != 0x1a ; p++ );
*p++= '\0';
hg_palet= p+8;
p+= 4; /* ロード位置 */
sizex= ((p[1]<<8)+*p)*8; p+= 2; /* サイズX */
sizey= (p[1]<<8)+*p; p+= 2; /* サイズY */
return TRUE;
}
GV_Err( "hgオープンできません" );
return FALSE;
}
GVIEW *
GV_Load_Hg( fname )
char *fname;
{
if( size_check( fname ) ){
GVIEW *gp;
if( !(gp= GV_Alloc( sizex, sizey, WindowAttrGraphic16,
fname, com+7, 0 )) ){
GV_Err( "メモリが足りません" );
return NULL;
}
if( GV_VramGetExec( HGLOADER, fname, gp ) ){
MFREE( gp );
GV_Err2( HGLOADER, "実行できませんでした" );
return NULL;
}
{
unsigned short *str= gp->palet;
unsigned char *ptr= hg_palet;
int i= GV_PaletSize( gp->color );
for(; i-- ; ptr+= 2 )
*str++= (ptr[1]<<8)+ *ptr;
}
GV_PaletToBase( gp );
return gp;
}
return NULL;
}